package com.designlollipopdemo.commonbar;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;

import com.designlollipopdemo.R;

public class TitleBarActivity extends AppCompatActivity {

    /**
     * 封装 标题栏    同事
     *
     * @param savedInstanceState
     */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_title_bar);
        initTitleBar();
    }


    //标题栏监听
    private void initTitleBar() {

        CustomTitlebar custombar = (CustomTitlebar) findViewById(R.id.custombar);
        custombar.setAction(new CustomTitlebar.TitleBarOnClickListener() {
            @Override
            public void performAction(View view) {
                switch (view.getId()) {
                    case R.id.ll_left:
                        Toast.makeText(TitleBarActivity.this, "左边区域", Toast.LENGTH_SHORT).show();
                        break;
                    case R.id.ll_right_container:
                        Toast.makeText(TitleBarActivity.this, "右边区域", Toast.LENGTH_SHORT).show();
                        break;
                }
            }
        });
    }
}
